package com.czy.seed.mvc.sys.mapper;

import com.czy.seed.mvc.sys.entity.SysResource;
import com.czy.seed.mvc.sys.entity.SysUser;
import com.czy.seed.mybatis.base.mapper.BaseMapper;
import com.czy.seed.mybatis.config.mybatis.annotations.AutoMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@AutoMapper
public interface SysUserMapper extends BaseMapper<SysUser> {



    @Select("SELECT\n" +
            "\tus.id AS id,\n" +
            "\tus.NAME AS name,\n" +
            "\tus.username AS username\n" +
            "\n" +
            "FROM\n" +
            "\tseed_sys_user as us\n" +
            "JOIN seed_sys_user_role AS usrole\n" +
            "JOIN seed_sys_role AS role\n" +
            "WHERE\n" +
            "\t1 = 1\n" +
            "AND usrole.SYS_USER_ID = us.ID\n" +
            "AND usrole.SYS_ROLE_ID = role.ID\n" +
            "AND us.CREATE_BY = #{userId}\n" +
            "AND role.CODE = #{type} ")
    public List<SysUser> presentUser(@Param("userId")Long userId,@Param("type") String type);

}
